<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%-- <jsp:include page="../../sso/LoginLog/list.jsp"/>
<jsp:include page="../../sys/BusLog/list.jsp"/> --%>
<jsp:include page="../../common/assets_header.jsp" />
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<script src="<%=request.getContextPath()%>/assets/js/date-time/bootstrap-datepicker.min.js"></script>
<script src="<%=request.getContextPath()%>/assets/js/jqGrid/jquery.jqGrid.min.js"></script>
<script src="<%=request.getContextPath()%>/assets/js/jqGrid/i18n/grid.locale-en.js"></script>
<link href="<%=request.getContextPath()%>/media/css/bootstrap-combined.min.css" rel="stylesheet">
<link href="<%=request.getContextPath()%>/media/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script type="text/javascript" src="<%=request.getContextPath()%>/media/js/bootstrap-datetimepicker.min.js"></script>
<%-- <script type="text/javascript" src="<%=request.getContextPath()%>/js/sysLoginLog.js"></script>
 --%>

<head>

</head>

<div class="page-content">
	<div class="row">
		<div class="col-sm-12">
			<div class="tabbable">
				<ul class="nav nav-tabs" id="myTab" style="margin-bottom: 0px;">
					<li class="active"><a aria-expanded="true" data-toggle="tab"
						href="#home"> <i class="green ace-icon fa fa-home bigger-120"></i>
							LoginLog
					</a></li>

					<li class=""><a aria-expanded="false" data-toggle="tab"
						href="#messages"> BusLog </a></li>
				</ul>

				<div class="tab-content">
					<div id="home" class="tab-pane fade in active" >
						<div class="row">
							<div class="col-sm-2">
								<label style="text-align: center;">企业编号：</label>
							</div>
							<div class="col-sm-2">
								<input type="text" id="searchId" class="m-wrap" />
							</div>
							<div class="col-sm-2">
								<label style="text-align: center;">登陆时间：</label>
							</div>
							<div class="col-sm-2 input-append date" id="startDatetimepicker">


								<input type="text" id="startTime" maxlength="30"
									class="hasDatepicker"  data-format="yyyy-MM-dd"> <i
									class="icon-calendar add-on" style="height:28px;"></i>

							</div>
							<div class="col-sm-2 input-append date" id="endDatetimepicker">


								<input type="text" id="endTime" maxlength="30" class="m-wrap" 
								class="hasDatepicker" data-format="yyyy-MM-dd"/>
								<i class="icon-calendar add-on" style="height:28px;"></i>


							</div>
							<div class="col-sm-2">
								<button class="btn btn-xs btn-primary" onclick="searchLoginLog();"
									id="searchBtn" >Search</button>
							</div>
						</div>
						<div class="row" style="padding-top: 20px;">
							<div class="col-xs-12">


								<!-- 列表 -->
								<table id="LoginLogTable"></table>
								<!-- 分页 -->
								<div id="LoginLogDiv"></div>
							</div>
						</div>
					</div>

					<div id="messages" class="tab-pane fade in" >
						<div class="row">
							<div class="col-xs-12">
							
							<div class="col-sm-2">
								<label style="text-align: center;">企业编号：</label>
							</div>
							<div class="col-sm-2">
								<input type="text" id="searchIdBus" class="m-wrap" />
							</div>
							<div class="col-sm-2">
								<label style="text-align: center;">登陆时间：</label>
							</div>
							<div class="col-sm-2 input-append date" id="startpicker">


								<input type="text" id="startTimeBus" maxlength="30"
									class="hasDatepicker"  data-format="yyyy-MM-dd">
									<i class="icon-calendar add-on" style="height:28px;"></i>
								

							</div>
							<div class="col-sm-2 input-append date" id="endpicker">


								<input type="text" id="endTimeBus" maxlength="30" class="m-wrap" 
								class="hasDatepicker" data-format="yyyy-MM-dd"/>
								<i class="icon-calendar add-on" style="height:28px;"></i>


							</div>
								<div class="form-group">
									<button class="btn btn-xs btn-primary" onclick="searchBusLog();"
										id="searchBusBtn" style="margin-left: 20px;">Search</button>
								</div>

								<!-- 列表 -->
								<table id="BusLogTable"></table>
								<!-- 分页 -->
								<div id="BusLogDiv"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>


<script>

<%-- var busurl = "<%=request.getContextPath()%>/sys/BusLog/list_json"
var Loginurl = "<%=request.getContextPath()%>/sso/LoginLog/list_json";
var pagefunction = function() {
	WORK.initLoginLogGird("LoginLogTable","LoginLogDiv",Loginurl)

	WORK.initBusLogGird("BusLogTable","BusLogDiv",busurl);
};


pagefunction();
 --%>
function searchLoginLog(){
	var val = $("#searchId").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
    var postData = $("#LoginLogTable").jqGrid("getGridParam", "postData");
    $.extend(postData, {"searchValue":val,"startTime":startTime,"endTime":endTime});
	$("#LoginLogTable").trigger("reloadGrid");
}
		
function searchBusLog(){
	var val = $("#searchIdBus").val();
	var startTime = $("#startTimeBus").val();
	var endTime = $("#endTimeBus").val();
    var postData = $("#BusLogTable").jqGrid("getGridParam", "postData");
    $.extend(postData, {"searchValue":val,"startTime":startTime,"endTime":endTime});
	$("#BusLogTable").trigger("reloadGrid");
}


$(function(){
	initBusLogGird();
	initLoginLogGird(); 
	 $('#startDatetimepicker').datetimepicker({
		 pickTime: false,
		 language: 'pt-BR'
		});
	 
	 $('#endDatetimepicker').datetimepicker({
		 pickTime: false,
		 language: 'pt-BR'
		});
	 
	 
	 $('#startpicker').datetimepicker({
		 pickTime: false,
		 language: 'pt-BR'
		});
	 
	 $('#endpicker').datetimepicker({
		 pickTime: false,
		 language: 'pt-BR'
		});
})



function initBusLogGird(){
	var grid_selector = "#BusLogTable";//列表对象
	var pager_selector = "#BusLogDiv";//列表分页对象
	
	jQuery(grid_selector).jqGrid({
		url : "<%=request.getContextPath()%>/sys/BusLog/list_json",
		datatype : "json",
		width: 1100,
		height: 300,
		colNames:[ ' ','登陆用户','企业编号','登陆时间','登陆ip','类名称','方法名','日志等级','提示信息'],
		colModel:[
		{name:'sysBusLogId',index:'sysBusLogId', width:60, sorttype:"int", hidden: true},
		{name:'username',index:'username',width:100,sortable:false},
		{name:'companyCode',index:'companyCode', width:100,sortable:false},
		{name:'createTime',index:'createTime', width:150,sortable:false},
		{name:'clientIp',index:'clientIp', width:150,sortable:false},
		{name:'className',index:'className', width:150,sortable:false},
		{name:'methodName',index:'methodName', width:150,sortable:false}, 
		{name:'logLevel',index:'logLevel', width:150,sortable:false},
		{name:'msg',index:'msg', width:150,sortable:false}
		], 
		viewrecords : true,
		rowNum:10,
		
		rowList:[10,20,30],
		pager : pager_selector,
		altRows: true,
		multiselect: false,
		 multiboxonly: true,
		 loadComplete : function() {
				
				
			},
		//editurl: $path_base+"/dummy.html",//nothing is saved
		caption: "Bus Log List",
		autowidth: true
	})
	
}


function initLoginLogGird(){
	var grid_selector = "#LoginLogTable";//列表对象
	var pager_selector = "#LoginLogDiv";//列表分页对象
	
	jQuery(grid_selector).jqGrid({
		url : "<%=request.getContextPath()%>/sso/LoginLog/list_json",
		datatype : "json",
		height: 300,
		colNames:[' ','登陆用户','企业编号','登陆时间','登陆ip'],
		colModel:[
		{name:'sysLoginLogId',index:'sysLoginLogId', width:60, sorttype:"int", hidden: true},
		{name:'username',index:'username',width:90,sortable:false},
		{name:'companyCode',index:'companyCode', width:90,sortable:false},
		{name:'loginTime',index:'loginTime', width:90,sortable:false},
		{name:'clientIp',index:'clientIp', width:90,sortable:false}
		], 
		viewrecords : true,
		rowNum:10,
		
		rowList:[10,20,30],
		pager : pager_selector,
		altRows: true,
		multiselect: false,
		 multiboxonly: true,
		 loadComplete : function() {
				
				
			},
		//editurl: $path_base+"/dummy.html",//nothing is saved
		caption: "Login Log List",
		autowidth: true
	});
}
</script>